package com.hznc.wcs.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;

/**
 * 流程实例 ProcessInstance 的状态
 */
@Getter
@AllArgsConstructor
public enum BpmProcessInstanceStatusEnum{

    RUNNING(1, "审批中"),
    APPROVE(2, "审批通过"),
    REJECT(3, "审批不通过"),
    CANCEL(4, "已取消");

    public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(BpmProcessInstanceStatusEnum::getStatus).toArray();

    /**
     * 状态
     */
    private final Integer status;
    /**
     * 描述
     */
    private final String desc;

    public static String descOfStatus(Integer status) {
        for (BpmProcessInstanceStatusEnum value : values()) {
            if (value.status.equals(status)) {
                return value.desc;
            }
        }
        return null;
    }

}
